<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <title>玉灵 QQ:7031633 Email:webrx@126.com</title>
    <script>
        function mm() {
            let ps = document.querySelectorAll('p')
            console.log(ps.length)
            ps.forEach(e => {
                e.style.transition = 'all .1s'
                e.style.width = `${Math.round(Math.random() * 800) + 300}px`
                e.style.color = `rgb(${Math.round(Math.random() * 255)}, ${Math.round(Math.random() * 255)}, ${Math.round(Math.random() * 255)})`
                e.style.backgroundColor = `rgb(${Math.round(Math.random() * 255)}, ${Math.round(Math.random() * 255)}, ${Math.round(Math.random() * 255)})`
            })
        }

        //加载事件
        window.onload = mm
        setInterval(mm, 500);

        //网页单击滚动，再单停止
        let fs = true
        let ms = ''
        window.onclick = () => {
            if (fs) {
                ms = setInterval(function () {
                    document.documentElement.scrollTop++
                }, 50)
            } else {
                clearInterval(ms)
            }
            fs = !fs
        }
    </script>
</head>

<body>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>
<p>Lorem ipsum dolor.</p>
<p>Neque, optio soluta?</p>
<p>Corporis, debitis, ullam.</p>
<p>Iste, omnis, quasi.</p>
<p>Distinctio, ex, minima!</p>
<p>Ea molestias, quidem!</p>
<p>Enim, harum velit.</p>
<p>Impedit obcaecati, possimus.</p>
<p>Quibusdam recusandae, voluptates.</p>
<p>Maxime, sed, suscipit!</p>
<p>Architecto, eligendi facere.</p>
<p>Consequuntur, error, quidem.</p>
<p>Numquam praesentium, sit?</p>
<p>Dignissimos, incidunt, reiciendis!</p>
<p>Ab atque, facilis.</p>
<p>Ab delectus, nulla!</p>

<style>
    .top {
        width: 80px;
        height: 80px;
        line-height: 80px;
        border: 1px solid gray;
        border-radius: 50%;
        position: fixed;
        right: 15px;
        bottom: 35px;
        background-color: #fff;
        text-align: center;
        display: none;
    }
</style>
<div class="top">gotop</div>
<script>
    document.querySelector('.top').onclick = function (e) {
        e.stopPropagation()
        document.documentElement.scrollTop = 0
    }

    window.onscroll = function () {
        let t = document.documentElement.scrollTop
        if (t > 1000) {
            document.querySelector('.top').style.display = 'block'
        } else {
            document.querySelector('.top').style.display = 'none'
        }
    }
</script>
</body>
</html>
